<style>
	.left{
		float:left;
	}
	.right{
		float:left;
	}
	.but{
		padding-left:25%;
		margin-top:20px;
	}
</style>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>储值卡设置</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.all.js"></script>
	</head>
	<body>
		<form class="layui-form update_form" id='my_form'>
			<input type="hidden" name='id' value="{$set_info['id']}">
			<div class="layui-form-item" style="margin-left: -180px;margin-bottom: 5px;margin-top: -15px;">
				<label class="layui-form-label" style="width: 35%;">鼓励金余额：{$agent_info.score}</label> 
			</div>
			<div class='left'>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 35%;">储值卡面额1：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="{$set_info['one_storage']}" name="one_storage" id='one_money' placeholder="" class="layui-input" lay-verify="required|check_moeny"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 35%;">储值卡面额2：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;" value="{$set_info['two_storage']}" name="two_storage" id='two_money' placeholder="" class="layui-input" lay-verify="required|check_moeny"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 35%;">储值卡面额3：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;" value="{$set_info['three_storage']}" name="three_storage" id='three_money' placeholder="" class="layui-input" lay-verify="required|check_moeny"  onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')">
					</div>
				</div>
			</div>
			
			<div class='right' style="margin-left: -25px">
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送卡金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['one_kj']?>" name="one_kj" id='one_kj' placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送卡金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['two_kj']?>" name="two_kj" id="two_kj" placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送卡金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['three_kj']?>" name="three_kj" id="three_kj" placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
			</div>
			
			<div class='right' style="float: right;position: absolute;left: 500px;">
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送鼓励金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['one_glj']?>" name="one_glj" id='glj_one' placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送鼓励金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['two_glj']?>" name="two_glj" id="glj_two" placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label" style="width: 30%;">赠送鼓励金：</label>
					<div class="layui-input-block update_shurk" style="width: 50%;">
						<input type="text" style="width: 65%;"  value="<?php echo $set_info['three_glj']?>" name="three_glj" id="three_glj" placeholder=" " class="layui-input" lay-verify="required|check_moeny">
					</div>
				</div>
			</div>
			
			<div class="layui-form-item update_btnbox">
				<div class="layui-input-block but">
					<button  id='change_but' class="layui-btn" lay-submit lay-filter="demo1" style="margin-left: 60px;">立即提交</button>
				</div>
			</div>
		</form>
	</body>
</html>
<script>
function set_content(){
	var glj_one = $('#glj_one').val();
	var glj_two = $('#glj_two').val();
	var three_glj = $('#three_glj').val();
	var zh = Number(glj_one)+Number(glj_two)+Number(three_glj);
	var score = "{$agent_info.score}";
	if(score < zh){
		layer.msg('鼓励金不足',{icon:1})
		return false;
	}
	 $.ajax({
     	type:"post",
        url:"{:url('index/set_storage')}",
        data: $('#my_form').serialize(),
        success:function(data){ 
            layer.msg(data.msg, {
				  icon: 1,
				  time: 1500 
				}, function(){
					var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
					parent.layer.close(index);
			});
        }
	});
}
	
	
	
	
//图片上传
layui.use(['form'], function(){
	var $ = layui.jquery,form = layui.form;
	
	form.verify({
	  check_moeny: function(value, item){ //value：表单的值、item：表单的DOM对象 
	    if(value <= 0){
	    	return "金额不能小于等于0元";
	    }
	  }
	});
	
	
  	//监听提交
	form.on('submit(demo1)', function(data){
		$('#change_but').addClass("layui-btn-disabled");
		
		set_content();
		
		return false;
	});
	
}) 
</script>
